<?php

session_start();

require_once ("../../../db.php");


if (!isset($_SESSION['uid']) || ($_SESSION['type'] != 'student')) {
    die('Not logged in as an student user');
}

// this removes a requset from the group
$sql = 'DELETE FROM projectrequest WHERE projectid=? AND groupid=?';
$sth = $db->prepare($sql);
$res = $sth->execute(array($_POST['projectid'], $_POST['groupid']));
if($res){
    echo json_encode(array('success' => 'Request fjernet'));
} else {
    echo json_encode(array('error' => 'Fjerne request feilet'));
}